package com.ipad.net.presenter.upload;

import android.content.Context;

import com.ipad.net.ApiCallback;
import com.ipad.net.ApiClient;
import com.ipad.net.apistore.StoreApi;
import com.ipad.net.entity.ObjectVo;
import com.ipad.net.mvp.BasePresenterImpl;

import java.util.Map;

/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class UploadPresenter extends BasePresenterImpl<UploadContract.View> implements UploadContract.Presenter {
    StoreApi storeApi;

    public UploadPresenter() {
        storeApi = ApiClient.getInstance().getjRetorfit().create(StoreApi.class);
    }

    @Override
    public void upload(Map map, String id,String container,String billCode,String token) {
        showDialog("上传中..");
        addSubscribe(storeApi.uploadSign(map,id,container,billCode, token), new ApiCallback<ObjectVo>() {
            @Override
            public void onSuccess(ObjectVo o) {
                mView.uploadSuccess(o);
            }

            @Override
            public void onFailuer(String msg) {
                mView.error(msg);
            }

            @Override
            public void onFinish() {
                dismissDialog();
            }
        });
    }
}
